<?php
    // array for JSON response
    $response = array();
    // include db connect class
    require_once __DIR__ . '/db_connect.php';
    // connecting to db
    $db = new DB_CONNECT();
	if (isset($_GET['userIdZing'])
	&& isset($_GET['userNameZing'])
	&& isset($_GET['userDisplayZing'])
	&& isset($_GET['avatar']))
	{
		$userDisplayZing = str_replace('+',' ',$_GET['userDisplayZing']);
			$query = "INSERT INTO `user`(`user_id_zing`, `user_name_zing`,`user_display_zing`, `user_avatar_zing`, `time_signin`)"
								." VALUES('".$_GET['userIdZing']."','".$_GET['userNameZing']."','".$userDisplayZing."','".$_GET['avatar']."',NOW())";
			$result = mysql_query($query);
			if ($result) {
				$json_result = array('message'=>'Insert new record success', 'success' => 1);
				echo json_encode($json_result);
			}
			else{
				$response["message"] = "Error while insert new record";
				$response["success"] = 0;
                echo json_encode($response);
			}
	}
	else{
		$response["message"] = "Error value _GET";
		$response["success"] = 0;
        echo json_encode($response);
	}
?>

